package com.ts.api.common.context;

import com.ts.api.module.channel.entity.cache.ChannelCacheUser;

/**
 * 渠道用户上下文
 */
public class ChannelUserContext {

    public static final ThreadLocal<ChannelCacheUser> USER = new ThreadLocal<>();

    /**
     * 获取对象
     *
     * @return ChannelCacheUser
     */
    public static ChannelCacheUser get() {
        return USER.get();
    }

    /**
     * 获取用户主键
     *
     * @return Integer
     */
    public static Long getId() {
        return USER.get().getUserId();
    }
}
